# Build the webpage

#print join("\n",%ENV);
#print "\n";

# Run ScarDoc on source tree and generate xml file containing all function info
my $g_DocLiteDir = "C:\\projects\\Warhammer\\src\\Shared_Tools\\DocLite";
my $g_DocLiteExe = "C:\\projects\\Warhammer\\src\\Shared_Tools\\DocLite\\DocLite.pl";
my $g_exe = "perl -w -I$g_DocLiteDir $g_DocLiteExe -dirs C:\\projects\\Warhammer\\Root\\W40K\\Data\\Scar;C:\\projects\\Warhammer\\src\\Game\\SimEngine\\LuaExports;C:\\projects\\Warhammer\\src\\Game\\W40kMod\\Simulation\\LuaLibs;C:\\projects\\Warhammer\\src\\Game\\SimEngine\\Scar -o xml\\function_list.xml -lua lua;scar -typemap ScarDocTypes.txt";

print( "system( \"$g_exe\" ) \n" );
system( $g_exe );

# Run saxon on the xml files to generate html using xsl stylesheets
my $usesaxon = 0;
if ($usesaxon ne 0)
{
	# Generate the function_list page
	system("C:/saxon/saxon.exe -o html/function_list.htm xml/function_list.xml xsl/function_list.xsl");

	# Generate the entity blueprint page
	system("C:/saxon/saxon.exe -o html/entity_blueprints.htm xml/blueprints.xml xsl/entity_blueprints.xsl");

	# Generate the squad blueprint page
	system("C:/saxon/saxon.exe -o html/squad_blueprints.htm xml/blueprints.xml xsl/squad_blueprints.xsl");

	# Generate the treeview
	system("C:/saxon/saxon.exe -o html/treeview/treecode_nojs.htm xml/scardoc.xml xsl/frame_toc.xsl");
	system("C:/saxon/saxon.exe -o html/treeview/treecode.htm xml/scardoc.xml xsl/js_frame_toc.xsl");

	# Generate the title frame
	system("C:/saxon/saxon.exe -o html/frame_header.htm xml/scardoc.xml xsl/frame_header.xsl");

	# Run saxon on the xml files to generate a API file for WSciTE
	system("C:/saxon/saxon.exe -o ScarW40K.api xml/function_list.xml xsl/wscite_api.xsl");
}
else
{
	# Generate the function_list page
	system("msxsl xml/function_list.xml xsl/function_list.xsl -o html/function_list.htm ");

	# Generate the entity blueprint page
	system("msxsl xml/blueprints.xml xsl/entity_blueprints.xsl -o html/entity_blueprints.htm ");

	# Generate the squad blueprint page
	system("msxsl xml/blueprints.xml xsl/squad_blueprints.xsl -o html/squad_blueprints.htm ");

	# Generate the treeview
	system("msxsl xml/scardoc.xml xsl/frame_toc.xsl -o html/treeview/treecode_nojs.htm ");
	system("msxsl xml/scardoc.xml xsl/js_frame_toc.xsl -o html/treeview/treecode.htm ");

	# Generate the title frame
	system("msxsl xml/scardoc.xml xsl/frame_header.xsl -o html/frame_header.htm ");

	# Run saxon on the xml files to generate a API file for WSciTE
	system("msxsl xml/function_list.xml xsl/wscite_api.xsl -o ScarW40K.api ");
}


